package io.polly.ldz.reactor.security;

import org.springframework.security.web.authentication.WebAuthenticationDetails;

import javax.servlet.http.HttpServletRequest;

/**
 * @author liqin@101.com
 * @version V1.0
 * @title: DigestWebAuthenticationDetails
 * @description: 扩展
 * @date: 2023/11/28 14:23
 */

public class DigestWebAuthenticationDetails extends WebAuthenticationDetails {

    private String randomCode;
    private String serialNumber;

    private String digestCode;

    private String remoteIp;


    public String getRandomCode() {
        return randomCode;
    }

    public void setRandomCode(String randomCode) {
        this.randomCode = randomCode;
    }

    public String getDigestCode() {
        return digestCode;
    }

    public void setDigestCode(String digestCode) {
        this.digestCode = digestCode;
    }

    public String getSerialNumber() {
        return serialNumber;
    }

    public void setSerialNumber(String serialNumber) {
        this.serialNumber = serialNumber;
    }



    public String getRemoteIp() {
        return remoteIp;
    }

    public void setRemoteIp(String remoteIp) {
        this.remoteIp = remoteIp;
    }

    public DigestWebAuthenticationDetails(HttpServletRequest request) {
        super(request);
        randomCode = String.valueOf(request.getAttribute("randomCode"));
        serialNumber = String.valueOf(request.getAttribute("serialNumber"));
        digestCode = String.valueOf(request.getAttribute("digestCode"));
        remoteIp = String.valueOf(request.getHeader("X-Real-IP"));
    }
}
